//
//  UIBarButtonItem+ZMHighlightCategory.m
//  DaMei
//
//  Created by mac on 16/2/22.
//  Copyright © 2016年 mac. All rights reserved.
//

#import "UIBarButtonItem+ZMHighlightCategory.h"

@implementation UIBarButtonItem (ZMHighlightCategory)
+(instancetype)barButtonItemWithImageName:(NSString *)imageName hightlightImageName:(NSString *)hightlightImageName target:(id)target action:(SEL)action {

    UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
    [btn setImage:[UIImage imageNamed:imageName]forState:UIControlStateNormal];
    [btn setImage:[UIImage imageNamed:hightlightImageName] forState:UIControlStateHighlighted];
    [btn addTarget:target action:action forControlEvents:UIControlEventTouchUpInside];
    [btn sizeToFit];
    
    return [[UIBarButtonItem alloc] initWithCustomView:btn];
    
}
@end
